//
//  CertificationViewController.m
//  Gxj
//
//  Created by 💋索少杰 on 2017/9/29.
//  Copyright © 2017年 wkq. All rights reserved.
//

#import "CertificationViewController.h"
#import "HomeParticipationBLViewController.h"
#import "HomeParticipationCXViewController.h"
#import "HomeParticipationQWViewController.h"

@interface CertificationViewController ()<SGPageTitleViewDelegate, SGPageContentViewDelegate>
    //**   滑动标题     **//
@property (nonatomic, strong) SGPageTitleView *pageTitleView;
@property (nonatomic, strong) SGPageContentView *pageContentView;
    //**              **//

@end

@implementation CertificationViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    switch (self.interCertification) {
        case 100004:
            
            NSLog(@"点击100004进入界面");
            break;
        case 100005:
            //我的参与
            [self setMyTakepartinUp];
            
            NSLog(@"点击100005进入界面");
            break;
        case 100006:
            
            NSLog(@"点击100006进入界面");
            break;
        case 100007:
            
            NSLog(@"点击100007进入界面");
            break;
        case 100008:
            
            NSLog(@"点击100008进入界面");
            break;
        default:
            break;
    }
    self.view.backgroundColor=[UIColor whiteColor];

}


#pragma mark   ---我的参与
-(void)setMyTakepartinUp
{
    self.navigationItem.title=@"家·参与";
    //导航条左边按钮
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"fanhui1"] style:UIBarButtonItemStyleDone target:self action:@selector(clickLeftBarButton)];
    //导航条右边按钮
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"xialagenduo"] style:UIBarButtonItemStyleDone target:self action:@selector(clickRightButton)];
    
    self.navigationController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName:[UIColor whiteColor],NSFontAttributeName:[UIFont boldSystemFontOfSize:17]};
    [self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"bg"]forBarMetrics:UIBarMetricsDefault];
    
    //标题滑动
    //辩论
    HomeParticipationBLViewController * bianlunView=[[HomeParticipationBLViewController alloc] init];
    //抢位
    HomeParticipationCXViewController * meetingView=[[HomeParticipationCXViewController alloc] init];
    //创想
    HomeParticipationQWViewController * imaginationView=[[HomeParticipationQWViewController alloc] init];
    
    NSArray * childArr = @[bianlunView,imaginationView,meetingView];
    CGFloat contentViewHeight = self.view.frame.size.height;
    self.pageContentView = [[SGPageContentView alloc] initWithFrame:CGRectMake(0, kHeightScale(64), self.view.frame.size.width, contentViewHeight) parentVC:self childVCs:childArr];
    _pageContentView.delegatePageContentView = self;
    [self.view addSubview:_pageContentView];
    NSArray *titleArr = @[@"会议", @"创想",@"抢位"];
    /// pageTitleView
    self.pageTitleView = [SGPageTitleView pageTitleViewWithFrame:CGRectMake(0, kHeightScale(64), self.view.frame.size.width, kHeightScale(36)) delegate:self titleNames:titleArr];
    [self.view addSubview:_pageTitleView];
    //_pageTitleView.backgroundColor=[UIColor colorWithRed:(242.0/255) green:(242.0/255) blue:(242.0/255) alpha:1];
    _pageTitleView.backgroundColor=[UIColor whiteColor];
    _pageTitleView.selectedIndex = 0;
    _pageTitleView.titleColorStateNormal = [UIColor colorWithRed:(102.0/255) green:(102.0/255) blue:(102.0/255) alpha:1];;
    _pageTitleView.titleColorStateSelected = [UIColor colorWithRed:(51.0/255) green:(51.0/255) blue:(51.0/255) alpha:1];
    _pageTitleView.indicatorColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"fengetiaotwo"]];
    _pageTitleView.indicatorLengthStyle = SGIndicatorLengthStyleEqual;
    _pageTitleView.isShowBottomSeparator = NO;
}
- (void)pageTitleView:(SGPageTitleView *)pageTitleView selectedIndex:(NSInteger)selectedIndex {
    [self.pageContentView setPageCententViewCurrentIndex:selectedIndex];
}

- (void)pageContentView:(SGPageContentView *)pageContentView progress:(CGFloat)progress originalIndex:(NSInteger)originalIndex targetIndex:(NSInteger)targetIndex {
    [self.pageTitleView setPageTitleViewWithProgress:progress originalIndex:originalIndex targetIndex:targetIndex];
}


//导航条返回按钮响应
- (void)clickLeftBarButton
{
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)clickRightButton
{
    
}





- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
